package com.tianshuo.circledepend.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @ClassName : CustomBeanPostProcessor
 * @Description : 自定义beanPostProcessor
 * @Author : tianshuo
 * @Date: 2020-09-02 10:42
 */
@Component
public class CustomBeanPostProcessor implements BeanPostProcessor {
    Logger logger = LoggerFactory.getLogger(CustomBeanPostProcessor.class);

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        logger.info("bean初始化之前调用： {} , beanName: {}",bean,beanName);
        return null;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        logger.info("bean初始化之后调用： {} , beanName: {}",bean,beanName);
        return null;
    }
}

